package com.fertshop.gui.listener;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JDialog;
import javax.swing.JScrollPane;

import com.fertshop.dto.ShopDto;
import com.fertshop.gui.Main;
import com.fertshop.gui.MainPanel;

public class ViewDetailsActionListener implements ActionListener {
	
	private JDialog dialog=null;
	
	public ViewDetailsActionListener(JDialog dialog){
		this.dialog=dialog;
	}

	@Override
	public void actionPerformed(ActionEvent event) {
		ShopDto spdto=Main.shopdto;
		MainPanel viewDetailsPanel=new MainPanel();
		viewDetailsPanel.setPreferredSize(new Dimension(600,600));
		
		viewDetailsPanel.getShopNameTf().setText(spdto.getShopName());
		viewDetailsPanel.getShopNameTf().setEditable(false);
		
		viewDetailsPanel.getProprietorNameTf().setText(spdto.getProprietorName());
		viewDetailsPanel.getProprietorNameTf().setEditable(false);
		
		viewDetailsPanel.getLicenseNoTf().setText(spdto.getLicenseNumber());
		viewDetailsPanel.getLicenseNoTf().setEditable(false);
		
		viewDetailsPanel.getAddressTa().setText(spdto.getAddress());
		viewDetailsPanel.getAddressTa().setEditable(false);
		
		viewDetailsPanel.getDoorNoTf().setText(spdto.getSpDoorNo());
		viewDetailsPanel.getDoorNoTf().setEditable(false);
		
		viewDetailsPanel.getAreaTf().setText(spdto.getSpArea());
		viewDetailsPanel.getAreaTf().setEditable(false);
		
		viewDetailsPanel.getSpDoorNoTf().setText(spdto.getStrgpDoorNo());
		viewDetailsPanel.getSpDoorNoTf().setEditable(false);
		
		viewDetailsPanel.getSpAreaTf().setText(spdto.getStrgpArea());
		viewDetailsPanel.getSpAreaTf().setEditable(false);
		
		viewDetailsPanel.getSubmit().setEnabled(false);
		viewDetailsPanel.getUpdateButton().setEnabled(false);
		
		dialog.setSize(500,650);
		JScrollPane scroll=new JScrollPane(viewDetailsPanel);
		scroll.setBounds(30, 120, 400, 400);
		Container ctr=dialog.getContentPane();
		ctr.add(scroll);
	}

}
